package lesson15;

public class ExerciseCar
{
	String brand;
	double price;
	boolean isSportCar;
	String model;
	String color;
	int gear;
	int currentSpeed;
	double maxSpeed;
	
	ExerPerson owner;
	
	
	ExerciseCar(String model, boolean isSportCar, String color)
	{
		
	}

	ExerciseCar() 
	{
	}

	ExerciseCar( int gear)
	{
		this.gear = gear;
	}
	
	ExerciseCar(int gear, String model)
	{
		this(gear);
		this.model = model;
	}
	
	ExerciseCar(int gear, String model, double price)
	{
		this(gear, model);
		this.price = price;
	}
	
	ExerciseCar(String model, String color, double price, double maxSpeed, int gear, String brand)
	{
		this(gear, model, price);
		this.color = color;
		this.maxSpeed = maxSpeed;
		if(maxSpeed > 200)
		{
			this.isSportCar = true;
		}
		this.brand = brand;
	}
	
	ExerciseCar(String model, String color, double price, double maxSpeed, int gear, String brand, ExerPerson owner)
	{
		this(model, color, price, maxSpeed,gear, brand);
		this.owner = owner;
	}
	
	 boolean isMoreExpensive (ExerciseCar car)
	{
		 if(this.price > car.price)
		 {
			 return true;
		 }
		 
		 else
		 {
			 return false;
		 }

		
	} 

	 double calculateCarPriceForScrap(double metalPrice)
	 {
		 double coef = 0.2;
		 	if(this.color.equalsIgnoreCase("Black") || this.color.equalsIgnoreCase("White"))
		 	{
		 		coef += 0.05;
		 	}
		 	if (this.isSportCar)
		 	{
		 		coef += 0.05;		 		
		 	}
		 	return metalPrice * coef;
	 }
	
	void changeOwner (ExerPerson newOwner)
	{
		this.owner = newOwner;
	}
	 
	 
	 
}
